package top.yekongle.shop.dao;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;
import top.yekongle.shop.entity.SysUser;

import java.util.List;

/**
 * @author Hank Lau
 * @date 2022/5/3
 */
public interface SysUserRepository extends CrudRepository<SysUser, Integer> {

	@Query("select u from sys_user u where username =?1")
	public SysUser getUserByName(@Param("username")String name);

//	@Query("select * from sys_user where username=?1 and password=?2")
//	public SysUser getUserByNameAndPassword(String username, String password);
//
//	@Query("select * from sys_user where id =?1")
//	public SysUser getUserById(int id);

	@Query("select u from sys_user u")
	public List<SysUser> getAll();

 }